unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, XStringGrid, ComCtrls;

type
  TForm4 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    GroupBox2: TGroupBox;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    c1: TComboBox;
    c2: TComboBox;
    c3: TComboBox;
    c4: TComboBox;
    c5: TComboBox;
    CheckBox7: TCheckBox;
    CheckBox8: TCheckBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    GroupBox7: TGroupBox;
    Label6: TLabel;
    Label7: TLabel;
    CheckBox3: TCheckBox;
    c6: TComboBox;
    c7: TComboBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox6: TCheckBox;
    GroupBox8: TGroupBox;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    c8: TComboBox;
    c9: TComboBox;
    Edit1: TEdit;
    Edit2: TEdit;
    GroupBox5: TGroupBox;
    Label19: TLabel;
    Label20: TLabel;
    C10: TComboBox;
    C11: TComboBox;
    GroupBox6: TGroupBox;
    Edit3: TEdit;
    Edit4: TEdit;
    procedure Button2Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure Button1Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure Edit2KeyPress(Sender: TObject; var Key: Char);
    procedure Edit1Exit(Sender: TObject);
    procedure Edit2Exit(Sender: TObject);
    procedure c9Change(Sender: TObject);
    procedure c1KeyPress(Sender: TObject; var Key: Char);
    procedure c2KeyPress(Sender: TObject; var Key: Char);
    procedure c3KeyPress(Sender: TObject; var Key: Char);
    procedure c4KeyPress(Sender: TObject; var Key: Char);
    procedure c5KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox1KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox2KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox8KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox7KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox3KeyPress(Sender: TObject; var Key: Char);
    procedure c6KeyPress(Sender: TObject; var Key: Char);
    procedure c7KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox4KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox5KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox6KeyPress(Sender: TObject; var Key: Char);
    procedure c8KeyPress(Sender: TObject; var Key: Char);
    procedure c9KeyPress(Sender: TObject; var Key: Char);
    procedure C10KeyPress(Sender: TObject; var Key: Char);
    procedure C11KeyPress(Sender: TObject; var Key: Char);
    procedure Edit3KeyPress(Sender: TObject; var Key: Char);
    procedure Edit4KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

{$R *.dfm}

procedure TForm4.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm4.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
       if not (Key in ['0'..'9','A','a','B','b','C','c','D','d','#','*',#8,#13]) then
      Key := #0 ;

          if key='a'then
     key:='A';
      if key='b'then
     key:='B';
      if key='c'then
     key:='C';
      if key='d'then
     key:='D';     

 if Key = #13 then
    SelectNext(Sender as TWinControl, True, True);
    
end;

procedure TForm4.Button1Click(Sender: TObject);
begin
     form4.c1.Text:='120';
     form4.c2.Text:='Off';
     form4.c3.Text:='4';
     form4.c4.Text:='Normal';
     form4.c5.Text:='English';

     form4.CheckBox1.Checked:=false;
     form4.CheckBox2.Checked:=false;
     form4.CheckBox7.Checked:=true;
     form4.CheckBox8.Checked:=true;

     form4.CheckBox3.Checked:=false;
     form4.c6.Text:='5';
     form4.c7.Text:='0.5';
     form4.CheckBox4.Checked:=false;
     form4.CheckBox5.Checked:=false;
     form4.CheckBox6.Checked:=false;

     form4.c8.Text:='DTMF';
     form4.c9.Text:='BOT';

     form4.Edit1.Text:='12345';
     form4.Edit2.Text:='';

     form4.c10.Text:='Monitor';
     form4.c11.Text:='Scan';

     form4.Edit3.Text:='';
     form4.Edit4.Text:='';

     Form4.c9Change(Sender);
     Form4.CheckBox1Click(Sender);
     Form4.CheckBox3Click(Sender);

end;

procedure TForm4.CheckBox3Click(Sender: TObject);
begin
  if form4.checkbox3.Checked=true then
begin
    form4.c6.Enabled:=true;
    form4.c7.Enabled:=true;
    form4.CheckBox4.Enabled:=true;
    form4.CheckBox5.Enabled:=true;
    form4.CheckBox6.Enabled:=true;
end else   if form4.checkbox3.Checked=false then
begin
    form4.c6.Enabled:=false;
    form4.c7.Enabled:=false;
    form4.CheckBox4.Enabled:=false;
    form4.CheckBox5.Enabled:=false;
    form4.CheckBox6.Enabled:=false;
end;

end;

procedure TForm4.CheckBox1Click(Sender: TObject);
begin
 if form4.checkbox1.Checked=true then
form4.checkbox2.Enabled:=false
else if form4.checkbox1.Checked=false then
form4.checkbox2.Enabled:=true;
end;

procedure TForm4.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
        if not (Key in ['0'..'9','A','a','B','b','C','c','D','d','#','*',#8,#13]) then
      Key := #0 ;

          if key='a'then
     key:='A';
      if key='b'then
     key:='B';
      if key='c'then
     key:='C';
      if key='d'then
     key:='D';     

 if Key = #13 then
    SelectNext(Sender as TWinControl, True, True); 
end;

procedure TForm4.Edit1Exit(Sender: TObject);
begin
   if (edit1.Text='') or(edit1.Text=' ')then
edit1.Text:='12345';
end;

procedure TForm4.Edit2Exit(Sender: TObject);
begin
  if (edit2.Text='') or(edit2.Text=' ')then
edit2.Text:='12345';
end;

procedure TForm4.c9Change(Sender: TObject);
begin
       if c9.Text='BOT'then
begin
edit1.Enabled:=true ;
edit2.Enabled:=false ;
end
else
if c9.Text='EOT'then
begin
edit2.Enabled:=true ;
edit1.Enabled:=false ;
end
else
if c9.Text='BOTH'then
begin
edit2.Enabled:=true ;
edit1.Enabled:=true ;
end;


end;

procedure TForm4.c1KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c2KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c3KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c4KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c5KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox1KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox2KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox8KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox7KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox3KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c6KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c7KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox4KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox5KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.CheckBox6KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c8KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.c9KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.C10KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.C11KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True)
 else
 key:=#0;
end;

procedure TForm4.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True);
end;

procedure TForm4.Edit4KeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #13 then
    SelectNext(Sender as TWinControl, True, True);
end;

end.
